package com.sunnybear.framework.ui.refresh;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

/**
 * <p>
 *  2018/8/17.
 */
public abstract class BaseLoadMoreFooter<VDB extends ViewDataBinding> extends FrameLayout {

    protected VDB mViewDataBinding;

    public BaseLoadMoreFooter(Context context) {
        super(context);
    }

    public BaseLoadMoreFooter(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public BaseLoadMoreFooter(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mViewDataBinding = DataBindingUtil.inflate(LayoutInflater.from(context), getLayoutId(), this, false);
        addView(mViewDataBinding.getRoot());
    }

    /**
     * 设置布局id
     *
     * @return 布局id
     */
    protected abstract int getLayoutId();

    public abstract void dragToShow(float offset);

    public abstract void releaseTouch();

    public abstract void startLoading();

    public abstract void scaleFooterToHide(long time);

    public abstract void reset();

}
